{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="title" placeholder="管理员账号|昵称|备注" value="{:input('get.title')}"
                                autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="sreach">搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn layui-btn-sm" onclick="data_edit('添加用户','input')"><i
                            class="layui-icon">&#xe654;</i>添加</button>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th><div class="layui-table-cell">ID</div></th>
                                <th><div class="layui-table-cell">金额</div></th>
                                <th><div class="layui-table-cell">账号</div></th>
                                <th><div class="layui-table-cell">备注</div></th>
                                <th><div class="layui-table-cell">类型</div></th>
                                <th><div class="layui-table-cell">所属省市</div></th>
                                <th><div class="layui-table-cell">管理（所属）区域|县</div></th>
                                <th><div class="layui-table-cell">管理（所属）街道|村镇</div></th>
                                <th><div class="layui-table-cell">登陆次数</div></th>
                                <th><div class="layui-table-cell">最后登陆</div></th>
                                <th><div class="layui-table-cell">操作</div></th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td><div class="layui-table-cell">{$v.id}</div></td>
                                <td><div class="layui-table-cell">{$v.integral|default=''}<a title="明细"
                                        onclick="data_edit('明细','/admin/moneylog?id={$v.id}')" href="javascript:;"
                                        class="layui-btn layui-btn-sm">
                                        {$v.money}</a>
                                    <a title="更改金额" onclick="orderstr('更改金额','/admin/money_str','{$v.id}')"
                                        href="javascript:;" class="layui-btn layui-btn-sm layui-bg-orange">
                                        更改金额
                                    </a>
                                </div></td>
                                <td><div class="layui-table-cell">{$v.username}</div></td>
                                <td><div class="layui-table-cell">{$v.nickname}</div></td>
                                <td><div class="layui-table-cell">{if $v.type == 1}
                                    <button type="button" class="layui-btn layui-btn-sm-normal layui-btn layui-btn-sm layui-btn layui-btn-sm-sm">总管理员</button>
                                    {elseif $v.type == 2}
                                    <button type="button" class="layui-btn layui-btn-sm-warm layui-btn layui-btn-sm layui-btn layui-btn-sm-sm">城市合伙人</button>
                                    {elseif $v.type == 3}
                                    <button type="button" class="layui-btn layui-btn-sm layui-btn layui-btn-sm layui-btn layui-btn-sm-sm">区、县合伙人</button>
                                    {elseif $v.type == 4}
                                    <button type="button" class="layui-btn layui-btn-sm layui-btn layui-btn-sm layui-btn layui-btn-sm-sm">街、村、镇合伙人</button>
                                    {else}
                                    {/if}
                                </div></td>
                                <td><div class="layui-table-cell">{$v.province_text|default=""}{$v.city_text|default=""}</div></td>
                                <td><div class="layui-table-cell">{if !empty($v.area_text)}
                                    {foreach $v.area_text as $area}
                                    {$area.name},
                                    {/foreach}
                                    {/if}
                                </div></td>
                                <td><div class="layui-table-cell">{if !empty($v.street_text)}
                                    {foreach $v.street_text as $street}
                                    {$street.name},
                                    {/foreach}
                                    {/if}
                                </div></td>
                                <td><div class="layui-table-cell">{$v.login_num}</div></td>
                                <td><div class="layui-table-cell">{$v.updated}</div></td>
                                <td class="td-manage">
                                    <a title="编辑" onclick="data_edit('编辑','/admin/input?id={$v.id}')"
                                        href="javascript:;" class="layui-btn layui-btn-sm">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a title="删除" onclick="data_del(this,'/admin/del','{$v.id}')" href="javascript:;"
                                        class="layui-btn layui-btn-sm-danger layui-btn layui-btn-sm">
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </div></td>
                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {if count($list) > 0}
                        {$list->render()|raw}
                        {/if}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    function orderstr(title, url, id, status) {
        layer.prompt({ title: '填写修改金额,大于0表示增，小于0表示扣除' }, function (value, index, elem) {
            $.post(url, { id: id, number: value }, function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg, { icon: 1, time: 1000 });
                    location.replace(location.href);
                } else {
                    layer.msg(data.msg, { icon: 2, time: 1000 });
                }
            });
            layer.close(index);
        });


    }
</script>
{include file="public/footer"}